# eric7.PluginManager.PluginManager

Module implementing the Plugin Manager.

### Global Attributes

SslAvailable

### Classes

PluginManager | Class implementing the Plugin Manager.

### Functions

None

## PluginManager

Class implementing the Plugin Manager.

### Signals

allPlugginsActivated()
  emitted at startup after all plugins have been activated
allTypedPlugginsActivated(pluginType)
  emitted at startup after all plugins of the type have been activated
pluginAboutToBeActivated(modulName, pluginObject)
  emitted just before a plugin is activated
pluginAboutToBeDeactivated(moduleName, pluginObject)
  emitted just before a plugin is deactivated
pluginActivated(moduleName, pluginObject)
  emitted just after a plugin was activated
pluginDeactivated(moduleName, pluginObject)
  emitted just after a plugin was deactivated
pluginRepositoryFileDownloaded()
  emitted to indicate a completed download of the plugin repository file
shutdown()
  emitted at shutdown of the IDE

### Derived from

QObject

### Class Attributes

None

### Class Methods

None

### Methods

PluginManager | Constructor
__canActivatePlugin | Private method to check, if a plugin can be activated.
__canDeactivatePlugin | Private method to check, if a plugin can be deactivated.
__checkPluginsDownloadDirectory | Private slot to check for the existence of the plugins download directory.
__downloadRepositoryFileDone | Private method called after the repository file was downloaded.
__getShortInfo | Private method to extract the short info from a module.
__insertPluginsPaths | Private method to insert the valid plugin paths into the search path.
__loadPlugins | Private method to load the plugins found.
__pluginDirectoriesExist | Private method to check, if the plugin folders exist.
__pluginModulesExist | Private method to check, if there are plugins available.
__shutdown | Private method called to perform actions upon shutdown of the IDE.
__sslErrors | Private slot to handle SSL errors.
activatePlugin | Public method to activate a plugin.
activatePlugins | Public method to activate all plugins having the "autoactivate" attribute set to True.
activateTypedPlugins | Public method to activate all plugins having the "autoactivate" attribute set to True and being of the given plugin type.
checkPluginEntry | Public method to check a plug-in's data for an update.
checkPluginUpdatesAvailable | Public method to check the availability of updates of plug-ins.
clearPluginsPrivateData | Public method to clear the private data of plug-ins of a specified type.
deactivatePlugin | Public method to deactivate a plugin.
deactivateVcsPlugins | Public method to deactivated all activated VCS plugins.
downLoadRepositoryFile | Public method to download the plugin repository file.
finalizeSetup | Public method to finalize the setup of the plugin manager.
getPluginApiFiles | Public method to get the list of API files installed by a plugin.
getPluginConfigData | Public method to get the config data of all active, non on-demand plugins used by the configuration dialog.
getPluginDetails | Public method to get detailed information about a plugin.
getPluginDir | Public method to get the path of a plugin directory.
getPluginDisplayStrings | Public method to get the display strings of all plugins of a specific type.
getPluginExeDisplayData | Public method to get data to display information about a plugins external tool.
getPluginInfos | Public method to get infos about all loaded plug-ins.
getPluginModules | Public method to get a list of plugin modules.
getPluginObject | Public method to activate an on-demand plugin given by type and type name.
getPluginPreviewPixmap | Public method to get a preview pixmap of a plugin of a specific type.
getPluginQtHelpFiles | Public method to get the list of QtHelp documentation files provided by a plug-in.
getVcsSystemIndicators | Public method to get the Vcs System indicators.
initOnDemandPlugin | Public method to create a plugin object for the named on demand plugin.
initOnDemandPlugins | Public method to create plugin objects for all on demand plugins.
initPluginToolbars | Public method to initialize plug-in toolbars.
isPluginActive | Public method to check, if a certain plugin is active.
isPluginLoaded | Public method to check, if a certain plugin is loaded.
isValidPluginName | Public method to check, if a file name is a valid plugin name.
loadDocumentationSetPlugins | Public method to load just the documentation sets plugins.
loadPlugin | Public method to load a plugin module.
pipInstall | Public method to install the given package via pip.
preferencesChanged | Public slot to react to changes in configuration.
removePluginFromSysModules | Public method to remove a plugin and all related modules from sys.modules.
unloadPlugin | Public method to unload a plugin module.

### Static Methods

None

#### PluginManager (Constructor)

PluginManager(parent=None, disabledPlugins=None, doLoadPlugins=True, develPlugin=None)

Constructor

The Plugin Manager deals with three different plugin directories. The first is the one, that is part of eric7 (eric7/Plugins). The second one is the global plugin directory called 'eric7plugins', which is located inside the site-packages directory. The last one is the user plugin directory located inside the .eric7 directory of the users home directory.

parent (QObject)
  reference to the parent object
disabledPlugins (list of str)
  list of plug-ins that have been disabled via the command line parameters '--disable-plugin='
doLoadPlugins (bool)
  flag indicating, that plug-ins should be loaded
develPlugin (str)
  filename of a plug-in to be loaded for development

Raises PluginModulesError:
  raised to indicate the absence of plug-in modules
Raises PluginPathError:
  raised to indicate an invalid plug-in path

#### PluginManager.__canActivatePlugin

__canActivatePlugin(module)

Private method to check, if a plugin can be activated.

module (Module)
  reference to the module to be activated

Return:
  flag indicating, if the module satisfies all requirements for being activated

Return Type:
  bool

Raises PluginClassFormatError:
  raised to indicate an invalid plug-in class format
Raises PluginModuleFormatError:
  raised to indicate an invalid plug-in module format

#### PluginManager.__canDeactivatePlugin

__canDeactivatePlugin(module)

Private method to check, if a plugin can be deactivated.

module (Module)
  reference to the module to be deactivated

Return:
  flag indicating, if the module satisfies all requirements for being deactivated

Return Type:
  bool

#### PluginManager.__checkPluginsDownloadDirectory

__checkPluginsDownloadDirectory()

Private slot to check for the existence of the plugins download directory.

#### PluginManager.__downloadRepositoryFileDone

__downloadRepositoryFileDone(reply)

Private method called after the repository file was downloaded.

reply (QNetworkReply)
  reference to the reply object of the download

#### PluginManager.__getShortInfo

__getShortInfo(module)

Private method to extract the short info from a module.

module (Module)
  module to extract short info from

Return:
  dictionary containing plug-in data

Return Type:
  dict ("plugin_name": str, "version": str, "short_desc": str, "error": bool)

#### PluginManager.__insertPluginsPaths

__insertPluginsPaths()

Private method to insert the valid plugin paths into the search path.

#### PluginManager.__loadPlugins

__loadPlugins()

Private method to load the plugins found.

#### PluginManager.__pluginDirectoriesExist

__pluginDirectoriesExist()

Private method to check, if the plugin folders exist.

If the plugin folders don't exist, they are created (if possible).

Return:
  tuple of a flag indicating existence of any of the plugin directories and a message

Return Type:
  tuple of (bool, str)

#### PluginManager.__pluginModulesExist

__pluginModulesExist()

Private method to check, if there are plugins available.

Return:
  flag indicating the availability of plugins

Return Type:
  bool

#### PluginManager.__shutdown

__shutdown()

Private method called to perform actions upon shutdown of the IDE.

#### PluginManager.__sslErrors

__sslErrors(reply, errors)

Private slot to handle SSL errors.

reply (QNetworkReply)
  reference to the reply object
errors (list of QSslError)
  list of SSL errors

#### PluginManager.activatePlugin

activatePlugin(name, onDemand=False)

Public method to activate a plugin.

name (str)
  name of the module to be activated
onDemand (bool)
  flag indicating activation of an on demand plugin

Return:
  reference to the initialized plugin object and an error string

Return Type:
  tuple of (QObject, str)

Raises PluginActivationError:
  raised to indicate an issue during the plug-in activation

#### PluginManager.activatePlugins

activatePlugins()

Public method to activate all plugins having the "autoactivate" attribute set to True.

#### PluginManager.activateTypedPlugins

activateTypedPlugins(pluginType)

Public method to activate all plugins having the "autoactivate" attribute set to True and being of the given plugin type.

pluginType (str)
  plugin type

#### PluginManager.checkPluginEntry

checkPluginEntry(_name, _short, _description, url, _author, version, filename, _status, _category, )

Public method to check a plug-in's data for an update.

_name (str)
  data for the name field (unused)
_short (str)
  data for the short field (unused)
_description (list of str)
  data for the description field (unused)
url (str)
  data for the url field
_author (str)
  data for the author field (unused)
version (str)
  data for the version field
filename (str)
  data for the filename field
_status (str)
  status of the plugin (one of stable, unstable, unknown) (unused)
_category (str)
  category designation of the plugin (unused)

#### PluginManager.checkPluginUpdatesAvailable

checkPluginUpdatesAvailable()

Public method to check the availability of updates of plug-ins.

#### PluginManager.clearPluginsPrivateData

clearPluginsPrivateData(pluginType)

Public method to clear the private data of plug-ins of a specified type.

Plugins supporting this functionality must support the module function 'clearPrivateData()' (and may have the module level attribute 'pluginType').

pluginType (str)
  type of the plugin to clear private data for

#### PluginManager.deactivatePlugin

deactivatePlugin(name, onDemand=False)

Public method to deactivate a plugin.

name (str)
  name of the module to be deactivated
onDemand (bool)
  flag indicating deactivation of an on demand plugin

#### PluginManager.deactivateVcsPlugins

deactivateVcsPlugins()

Public method to deactivated all activated VCS plugins.

#### PluginManager.downLoadRepositoryFile

downLoadRepositoryFile(url=None)

Public method to download the plugin repository file.

url (QUrl or str (optional))
  URL to get the plugin repository file from (defaults to None)

#### PluginManager.finalizeSetup

finalizeSetup()

Public method to finalize the setup of the plugin manager.

#### PluginManager.getPluginApiFiles

getPluginApiFiles(language)

Public method to get the list of API files installed by a plugin.

language (str)
  language of the requested API files

Return:
  list of API filenames

Return Type:
  list of str

#### PluginManager.getPluginConfigData

getPluginConfigData()

Public method to get the config data of all active, non on-demand plugins used by the configuration dialog.

Plugins supporting this functionality must provide the plugin module function 'getConfigData' returning a dictionary with unique keys of lists with the following list contents:

display string
  string shown in the selection area of the configuration page. This should be a localized string
pixmap name
  filename of the pixmap to be shown next to the display string
page creation function
  plugin module function to be called to create the configuration page. The page must be subclasses from Preferences.ConfigurationPages.ConfigurationPageBase and must implement a method called 'save' to save the settings. A parent entry will be created in the selection list, if this value is None.
parent key
  dictionary key of the parent entry or None, if this defines a toplevel entry.
reference to configuration page
  This will be used by the configuration dialog and must always be None

Return:
  plug-in configuration data

Return Type:
  dict

#### PluginManager.getPluginDetails

getPluginDetails(name)

Public method to get detailed information about a plugin.

name (str)
  name of the module to get detailed infos about

Return:
  details of the plugin as a dictionary

Return Type:
  dict

#### PluginManager.getPluginDir

getPluginDir(key)

Public method to get the path of a plugin directory.

key (str)
  key of the plug-in directory

Return:
  path of the requested plugin directory

Return Type:
  str

#### PluginManager.getPluginDisplayStrings

getPluginDisplayStrings(pluginType)

Public method to get the display strings of all plugins of a specific type.

pluginType (str)
  type of the plugins

Return:
  dictionary with name as key and display string as value

Return Type:
  dict

#### PluginManager.getPluginExeDisplayData

getPluginExeDisplayData()

Public method to get data to display information about a plugins external tool.

Return:
  list of dictionaries containing the data. Each dictionary must either contain data for the determination or the data to be displayed.
  A dictionary of the first form must have the following entries:
  - programEntry - indicator for this dictionary form (boolean), always True
  - header - string to be diplayed as a header (string)
  - exe - the executable (string)
  - versionCommand - commandline parameter for the exe (string)
  - versionStartsWith - indicator for the output line containing the version (string)
  - versionPosition - number of element containing the version (integer)
  - version - version to be used as default (string)
  - versionCleanup - tuple of two integers giving string positions start and stop for the version string (tuple of integers)
  A dictionary of the second form must have the following entries:
  - programEntry - indicator for this dictionary form (boolean), always False
  - header - string to be diplayed as a header (string)
  - text - entry text to be shown (string)
  - version - version text to be shown (string)

Return Type:
  list of dict

#### PluginManager.getPluginInfos

getPluginInfos()

Public method to get infos about all loaded plug-ins.

Return:
  list of dictionaries with keys "module_name", "plugin_name", "version", "auto_activate", "active", "short_desc", "error"

Return Type:
  list of dict ("module_name": str, "plugin_name": str, "version": str, "auto_activate": bool, "active": bool, "short_desc": str, "error": bool)

#### PluginManager.getPluginModules

getPluginModules(pluginPath)

Public method to get a list of plugin modules.

pluginPath (str)
  name of the path to search

Return:
  list of plugin module names

Return Type:
  list of str

#### PluginManager.getPluginObject

getPluginObject(pluginType, pluginTypename, maybeActive=False)

Public method to activate an on-demand plugin given by type and type name.

pluginType (str)
  type of the plugin to be activated
pluginTypename (str)
  name of the plugin within the type category
maybeActive (bool)
  flag indicating, that the plugin may be active already

Return:
  reference to the initialized plugin object and an error string

Return Type:
  tuple of (QObject, str)

#### PluginManager.getPluginPreviewPixmap

getPluginPreviewPixmap(pluginType, name)

Public method to get a preview pixmap of a plugin of a specific type.

pluginType (str)
  type of the plugin
name (str)
  name of the plugin type

Return:
  preview pixmap

Return Type:
  QPixmap

#### PluginManager.getPluginQtHelpFiles

getPluginQtHelpFiles()

Public method to get the list of QtHelp documentation files provided by a plug-in.

Return:
  dictionary with documentation type as key and list of files as value

Return Type:
  dict (key: str, value: list of str)

#### PluginManager.getVcsSystemIndicators

getVcsSystemIndicators()

Public method to get the Vcs System indicators.

Plugins supporting this functionality must support the module function getVcsSystemIndicator returning a dictionary with indicator as key and a tuple with the vcs name (string) and vcs display string (string).

Return:
  dictionary with indicator as key and a list of tuples as values. Each tuple contains the vcs name (str) and vcs display string (str).

Return Type:
  dict

#### PluginManager.initOnDemandPlugin

initOnDemandPlugin(name)

Public method to create a plugin object for the named on demand plugin.

Note: The plug-in is not activated.

name (str)
  name of the plug-in

Raises PluginActivationError:
  raised to indicate an issue during the plug-in activation

#### PluginManager.initOnDemandPlugins

initOnDemandPlugins()

Public method to create plugin objects for all on demand plugins.

Note: The plugins are not activated.

#### PluginManager.initPluginToolbars

initPluginToolbars(toolbarManager)

Public method to initialize plug-in toolbars.

toolbarManager (EricToolBarManager)
  reference to the toolbar manager object

#### PluginManager.isPluginActive

isPluginActive(pluginName)

Public method to check, if a certain plugin is active.

pluginName (str)
  name of the plugin to check for

Return:
  flag indicating, if the plugin is active

Return Type:
  bool

#### PluginManager.isPluginLoaded

isPluginLoaded(pluginName)

Public method to check, if a certain plugin is loaded.

pluginName (str)
  name of the plugin to check for

Return:
  flag indicating, if the plugin is loaded

Return Type:
  bool

#### PluginManager.isValidPluginName

isValidPluginName(pluginName)

Public method to check, if a file name is a valid plugin name.

Plugin modules must start with "Plugin" and have the extension ".py".

pluginName (str)
  name of the file to be checked

Return:
  flag indicating a valid plugin name

Return Type:
  bool

#### PluginManager.loadDocumentationSetPlugins

loadDocumentationSetPlugins()

Public method to load just the documentation sets plugins.

Raises PluginModulesError:
  raised to indicate the absence of plug-in modules

#### PluginManager.loadPlugin

loadPlugin(name, directory, reload_=False, install=False)

Public method to load a plugin module.

Initially all modules are inactive. Modules that are requested on demand are sorted out and are added to the on demand list. Some basic validity checks are performed as well. Modules failing these checks are added to the failed modules list.

name (str)
  name of the module to be loaded
directory (str)
  name of the plugin directory
reload_ (bool)
  flag indicating to reload the module
install (bool)
  flag indicating a load operation as part of an installation process

Raises PluginLoadError:
  raised to indicate an issue loading the plug-in

#### PluginManager.pipInstall

pipInstall(packages)

Public method to install the given package via pip.

packages (list of str)
  list of packages to install

#### PluginManager.preferencesChanged

preferencesChanged()

Public slot to react to changes in configuration.

#### PluginManager.removePluginFromSysModules

removePluginFromSysModules(pluginName, package, internalPackages)

Public method to remove a plugin and all related modules from sys.modules.

pluginName (str)
  name of the plugin module
package (str)
  name of the plugin package
internalPackages (list of str)
  list of intenal packages

Return:
  flag indicating the plugin module was found in sys.modules

Return Type:
  bool

#### PluginManager.unloadPlugin

unloadPlugin(name)

Public method to unload a plugin module.

name (str)
  name of the module to be unloaded

Return:
  flag indicating success

Return Type:
  bool

Up